import {observable, autorun} from 'mobx';

let todoStore = observable({
    todos: [],

    get completedCount() {
        return this.todos.filter(todo => todo.completed).length
    }

});

autorun(() => {
    console.log("completed items",
        todoStore.completedCount,
        todoStore.todos.length
    );
});

todoStore.todos[0] = {
    title: "111",
    completed: false
};

todoStore.todos[0].completed = true;
